<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    *{
      margin: 0;
      padding: 0;
    }

    .box {
      width: 500px;
      height: 150px;
      margin: 100px auto;
      border: 1px solid #333;
      display: flex;
      justify-content: space-around;
      align-items: center;
    }

    .box .hour img,
    .box .minute img{
      margin-left: 5px;
    }


    .dots .dot{
      margin: 20px 0;
      border-radius: 50%;
      height: 10px;
      width: 10px;
      background-color: #333;
      display: flex ;
      flex-direction: column;
      align-items: center;
      justify-content: space-between;
    }


  </style>
</head>
<body>
  <div class="box">
    <div class="hour">
      <!-- <img src="" alt="">
      <img src="" alt=""> -->
    </div>
    <div class="dots">
      <div class="dot"></div>
      <div class="dot"></div>
    </div>
    <div class="minute">
      <!-- <img src="" alt="">
      <img src="" alt=""> -->
    </div>
  </div>
</body>
<script>
  // 获取元素
  const Hour = document.querySelector('.hour');
  const Minute = document.querySelector('.minute');

  // 获取当前时间
  const currentTime = new Date();
  const currentHour = currentTime.getHours();
  const currentMinute = currentTime.getMinutes();

  // 将创建的img放入对应位置
  checkImg(currentHour,'currentHour');
  checkImg(currentMinute,'currentMinute');
  



  // 创建img
  function createImg(type) {
    const img = document.createElement('img');
    img.src = '../images/' + type + '.png';
    return img;
  }

  // 判断对应时间对应的图片
  function checkImg(currentTime,type){
    const img = (currentTime-(currentTime%10))/10
    let img1 = createImg(img);
    let img2 = createImg(currentTime%10);
    console.log(img1)
    console.log(img2)

    if (type === 'currentHour') {
      // 图片插入Hour中
      Hour.appendChild(img1);
      Hour.appendChild(img2);
    }else {
      // 图片插入Minute中
      Minute.appendChild(img1);
      Minute.appendChild(img2);
    }
  } 

</script>
</html>